package com.example.main;

import com.example.mattrigle.R;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.os.Handler;
import android.view.Menu;
import android.view.MenuItem;
import android.view.Window;
import android.view.animation.Animation;
import android.view.animation.AnimationUtils;
import android.widget.ImageView;

public class SplashActivity extends Activity {

	Handler handler;
	Runnable runnable;
	Long delay_time;
	Long time = 4000L;

	Animation ani ;
	ImageView logo;
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		requestWindowFeature(Window.FEATURE_NO_TITLE);
		setContentView(R.layout.activity_splash);
		
		logo = (ImageView)findViewById(R.id.imgLogo);
		ani = AnimationUtils.loadAnimation(getApplicationContext(),
				R.anim.fade_in);
		logo.setAlpha(10);
		logo.setAlpha(1000);
		logo.startAnimation(ani);
	
		handler = new Handler();

		runnable = new Runnable() {
			public void run() {
			
				startActivity(new Intent(SplashActivity.this, SplashActivity1.class));
				overridePendingTransition(R.anim.fade_in, R.anim.fade_out);
				
			
				
				
				finish();
			}
		};
	}

	public void onResume() {
		super.onResume();
		delay_time = time;
		handler.postDelayed(runnable, delay_time);
		time = System.currentTimeMillis();
	}

	public void onStop() {
		super.onStop();
		handler.removeCallbacks(runnable);
		time = delay_time - (System.currentTimeMillis() - time);
	}
}
